<?php

class Person_model extends CI_Model 
{
    function __construct()
    {
        parent::__construct();
    }
	
	function get_persons()
	{
		$this->db->from('person');
		
		$query = $this->db->get();
		
		return $query->result();
	}
	
	function get_person($id)
	{
		$this->db->from('person')->where('id', $id);
		
		$query = $this->db->get();
		$result = $query->result();
		
		return $result[0];
	}
	
	function create($data)
	{
		$this->db->insert('person', $data);
		return $this->db->insert_id();
	}
}